import 'package:flutter/cupertino.dart';

/// FileName layout_max_width_container
///
/// @Author lax
/// @Date 2024/6/6
///
/// @Description

class LayoutMaxWidthContainer extends StatelessWidget {
  final Alignment? alignment;
  final Widget? child;
  final double? minWidth;
  final double? minHeight;
  final BoxDecoration? decoration;

  const LayoutMaxWidthContainer({
    super.key,
    this.alignment,
    this.child,
    this.minWidth,
    this.minHeight,
    this.decoration,
  });

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (cont, cons) {
      return UnconstrainedBox(
        alignment: alignment ?? Alignment.center,
        child: Container(
          decoration: decoration,
          constraints: BoxConstraints(
            minWidth: minWidth ?? 0,
            minHeight: minHeight ?? 0,
            maxWidth: cons.maxWidth,
            maxHeight: cons.maxHeight,
          ),
          child: child,
        ),
      );
    });
  }
}
